﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace csharp_event
{
    public delegate void Delegate(string msg);

    public 
    
    class Program
    {
        public static event Delegate Event;

        // listener
        static void EventHandler(string msg)
        {
            Console.WriteLine(msg);
        }
        
        static void Main(string[] args)
        {
            // regist listener
            Event += new Delegate(EventHandler);

            // fire event
            Event("event occur!!!");

            Console.WriteLine("Press Any Key");
            Console.ReadKey();
        }
    }
}
